package com.heying.springcore.javaconfig;

import com.heying.springcore.SpringConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;


public class TestSpring {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext(SpringConfig.class);
//    Driver driver = context.getBean("driver",Driver.class);
//    driver.drive();
        Student zs = context.getBean("borrower",Student.class);
        Student ls = context.getBean("lender",Student.class);
        System.out.println(zs);
        System.out.println(ls);
        zs.borrow(400);
        System.out.println("----------借钱后----------");
//        Student zs2 = context.getBean("borrower",Student.class);
//        Student ls2 = context.getBean("lender",Student.class);
        System.out.println(zs);
        System.out.println(ls);
    }
}
